package me.yuxiaoyao.jpa.nativesql.mapper;

import org.reflections.Reflections;

import java.lang.annotation.Annotation;
import java.util.LinkedHashSet;
import java.util.Set;

/**
 * @author kerryzhang on 2020/12/16
 */


class PackageUtil {

    public static Set<Class<?>> getAllClassByPackage(Class<? extends Annotation> annoClass, String... pkgs) {
        Set<Class<?>> set = new LinkedHashSet<>();
        for (String pkg : pkgs) {
            Reflections reflections = new Reflections(pkg);
            Set<Class<?>> findClass = reflections.getTypesAnnotatedWith(annoClass);
            set.addAll(findClass);
        }
        return set;
    }

}
